<?php

namespace App\Http\Controllers;

use App\Http\Service\ProductcategoryparentService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use App\Http\Service\ViewcountService;
use Illuminate\Support\Facades\DB;

class ProductcategoryparentController extends BaseController
{
    private $getRules=[
            'type'=> 'required',
            //'city_code'=>'required',
        ];
    private  $getRulesMessage=[
            'type.required'=> 'type不能为空',
           // 'city_code.required'=> 'city_code不能为空',

        ];
    public $repository;
    public $historyservice;
    public function __construct(ProductcategoryparentService $repository,ViewcountService $historyservice)
    {
        parent::__construct();
        $this->repository = $repository;
        $this->historyservice = $historyservice;
    }
    /**
     *  爆料分类 -一级分类
     *  
     * @param Request $request
     * @return JsonResponse
     */
    public function getList(Request $request)
    {
        $data=[
            'limit'=>$request->json("limit"),
           
        ];
        //dd($data);

        
        $this->success($this->repository->getList($request,$data));
    }

    #爆料分类 -二级分类
    public function getList2(Request $request)
    {
        
        $data=[
            'category_id'=>$request->json("category_id"),
            'parent_id'=>$request->json("parent_id"),
            'limit'=>$request->json("limit"),

        ];
        $this->success($this->repository->getList2($request,$data));
    }
   
  

}
